const path = require('path');
const HtmlWebpackPlugin = require('html-webpack-plugin');
const VueLoaderPlugin = require('vue-loader/lib/plugin');
const CleanWebpackPlugin = require('clean-webpack-plugin');//build前清理文件
module.exports = {

    mode: "development",
    devtool: 'inline-source-map',
    devServer: {
        contentBase: './dist'
    },
    entry: {
        index: './src/index.js',
        index2: './src/index.js',

    },
    // output: {
    //     filename: '[name].js',
    //     path: path.resolve(__dirname, 'dist')
    // },
    plugins: [
        new CleanWebpackPlugin(),
        new HtmlWebpackPlugin({
            title: '1',
            template: './src/index.html',
            chunks: ['index'],
            filename: 'index.html',
            inject: true|'body' //所有JavaScript资源插入到body元素的底部
        }),
        new HtmlWebpackPlugin({
            title: '2',
            template: './src/index.html',
            chunks: ['index2'],
            filename: 'index2.html'
        }),
        new VueLoaderPlugin()
    ],
    module: {
        rules: [
            {
                test: /\.vue$/,
                loader: 'vue-loader',
                options: {
                    loaders: {}
                    // other vue-loader options go here
                }
            },
            {
                test: /\.js$/,
                loader: 'babel-loader',
                exclude: /node_modules/
            },
            {
                test: /\.css$/,
                loader: 'style-loader!css-loader'
            }
        ]
    }
};